package com.beteng.su.betengsu.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.support.annotation.NonNull;
import android.util.AttributeSet;

import com.beteng.su.betengsu.R;
import com.beteng.su.betengsu.bean.SpinnerBean;
import com.jaredrummler.materialspinner.MaterialSpinner;
import com.jaredrummler.materialspinner.MaterialSpinnerAdapter;
import com.jaredrummler.materialspinner.MaterialSpinnerBaseAdapter;

import java.util.List;

/**
 * Created by yy on 2017/8/14.
 */

public class MyMaterialSpinner extends MaterialSpinner {

    private int background;


    public MyMaterialSpinner(Context context) {
        super(context);
        init(context, null);
    }

    public MyMaterialSpinner(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context, attrs);
    }

    public MyMaterialSpinner(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context, attrs);
    }

    private void init(Context context, AttributeSet attrs){
        TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.MaterialSpinner);
        try {
            background = ta.getResourceId(R.styleable.MaterialSpinner_ms_background,R.drawable.ms__selector);
        }finally {
            ta.recycle();
        }
        setBackgroundResource(background);
    }





}
